package cn.ztw.controller;


import cn.ztw.domain.User;
import cn.ztw.feigenclients.UserFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: springcloudnetflix-parent
 * @BelongsPackage: cn.itsource.controller
 * @Author: Director
 * @CreateTime: 2022-07-30  10:21
 * @Description: 支付服务接口
 * @Version: 1.0
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    // 注入feign接口
    @Autowired
    private UserFeignClient userFeignClient;

    /*
     * @Description: 调用user服务接口并返回
     * @Author: Director
     * @Date: 2022/7/30 10:22
     * @param id: 参数Id
     * @return: cn.itsource.domain.User
     **/
    @GetMapping("/getById/{id}")
    public User getById(@PathVariable("id") Long id){
        // 调用OpenFeign接口，通信User服务
        return userFeignClient.getById(id);
    }

}